//
//  headView.m
//  qulvyou
//
//  Created by mmyy on 15/10/26.
//  Copyright (c) 2015年 mmyy. All rights reserved.
//

#import "headView.h"

@implementation headView
+(UIView *)getHeadViewWithWeatherHeader:(weatherHeader *)header andWeatherDayItems:(weatherDayItems *)weatherDay withFrame:(CGRect )rect
{
    UIView *_headView = [[UIView alloc] initWithFrame:rect];
    _headView.backgroundColor = [UIColor clearColor];
    UILabel *day = [headView createTableView:CGRectMake(5, 5, 50, 30) textFont:[UIFont boldSystemFontOfSize:19] andText:@"日期:"];
    [_headView addSubview:day];
    UILabel *currentDay = [headView createTableView:CGRectMake(5 + 50 + 5, 5, 200, 30) textFont:[UIFont systemFontOfSize:17] andText:weatherDay.date];
    [_headView addSubview:currentDay];
    UILabel *tianqi = [headView createTableView:CGRectMake(5, 5 + 30 + 5, 100, 30) textFont:[UIFont boldSystemFontOfSize:19] andText:@"天气情况:"];
    [_headView addSubview:tianqi];
    
    UILabel *currentTian = [headView createTableView:CGRectMake(100 + 5 + 5, 5 + 30 + 5, 100, 30) textFont:[UIFont systemFontOfSize:17] andText:weatherDay.tianqi];
    [_headView addSubview:currentTian];
    UILabel *chuangyiTishi = [headView createTableView:CGRectMake(5, 5 + 30 + 5 + 30, 100, 30) textFont:[UIFont boldSystemFontOfSize:19] andText:@"穿衣提醒:"];
    [_headView addSubview:chuangyiTishi];
    UILabel *chuanyi = [[UILabel alloc] initWithFrame:CGRectMake(5, 5 + 30 + 5 + 30 + 5 + 8, _headView.frame.size.width - 10, 60)];
    chuanyi.text = [NSString stringWithFormat:@"        %@", header.chuangyi];
    chuanyi.backgroundColor = [UIColor clearColor];
    chuanyi.textColor = [UIColor whiteColor];
    chuanyi.adjustsFontSizeToFitWidth = YES;
    chuanyi.lineBreakMode = NSLineBreakByWordWrapping;
    chuanyi.numberOfLines = 0;
    [_headView addSubview:chuanyi];
    
    
    UILabel *yudongti = [headView createTableView:CGRectMake(5, 5 + 30 + 5 + 30 + 60 + 5, 100, 30) textFont:[UIFont boldSystemFontOfSize:19] andText:@"运动提醒:"];
    [_headView addSubview:yudongti];
    UILabel *yundong = [[UILabel alloc] initWithFrame:CGRectMake(5, 5 + 30 + 5 + 30 + 60 + 15 , _headView.frame.size.width - 10, 60)];
    yundong.text = [NSString stringWithFormat:@"        %@", header.yundong];
    yundong.backgroundColor = [UIColor clearColor];
    yundong.textColor = [UIColor whiteColor];
    yundong.adjustsFontSizeToFitWidth = YES;
    yundong.lineBreakMode = NSLineBreakByWordWrapping;
    yundong.numberOfLines = 0;
    [_headView addSubview:yundong];
    
    
    UILabel *zieaixiantish = [headView createTableView:CGRectMake(5, 5 + 30 + 5 + 30 + 60 + 5 + 20 + 35, 100, 30) textFont:[UIFont boldSystemFontOfSize:19] andText:@"紫外线提醒:"];
    [_headView addSubview:zieaixiantish];
    UILabel *ziwaixian = [[UILabel alloc] initWithFrame:CGRectMake(5, 5 + 30 + 5 + 30 + 60 + 15 + 20 + 40 , _headView.frame.size.width - 10, 60)];
    ziwaixian.text = [NSString stringWithFormat:@"        %@", header.ziwaixian];
    ziwaixian.backgroundColor = [UIColor clearColor];
    ziwaixian.textColor = [UIColor whiteColor];
    ziwaixian.adjustsFontSizeToFitWidth = YES;
    ziwaixian.lineBreakMode = NSLineBreakByWordWrapping;
    ziwaixian.numberOfLines = 0;
    [_headView addSubview:ziwaixian];

    UIView *lineView = [[UIView alloc] initWithFrame:CGRectMake(5, 5 + 30 + 5 + 30 + 60 + 15 + 20 + 30 + 60 + 5, _headView.frame.size.width, 2)];
    lineView.backgroundColor = [UIColor whiteColor];
    [_headView addSubview:lineView];
    
    
    return _headView;

}
+(UILabel *)createTableView:(CGRect)rect textFont:(UIFont *)font andText:(NSString *)text
{
    UILabel *label = [[UILabel alloc] initWithFrame:rect];
    label.text = text;
    label.font = font;
    label.textColor = [UIColor whiteColor];
    label.adjustsFontSizeToFitWidth = YES;
    return label;
}

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
